package com.mdd.admin.service.order;

import com.alipay.api.AlipayApiException;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.mdd.admin.validate.order.OrderPageParam;
import com.mdd.admin.validate.order.OrderParam;
import com.mdd.admin.vo.finance.FinanceVo;
import com.mdd.admin.vo.order.OrderDetailVo;
import com.mdd.admin.vo.order.OrderListVo;
import com.mdd.admin.vo.order.StatisticsOrderVo;
import com.mdd.common.core.PageResult;
import com.mdd.common.entity.order.Order;

import java.util.List;
import java.util.Map;

/**
 * 订单服务接口类
 */
public interface IOrderService {

    /**
     * 订单列表
     *
     * @param params 搜索参数
     * @return PageResult<OrderVo>
     */
    PageResult<OrderListVo> list(OrderPageParam params, Boolean isSalesman);

    PageResult<OrderListVo> salesmanList(OrderPageParam params);

    /**
     * 统计订单的金额数据
     * @param params
     * @return
     */
    FinanceVo countList(OrderPageParam params);

    /**
     * 订单详情
     *
     * @param id 主键ID
     * @return Order
     */
    OrderDetailVo detail(Long id);

    /**
     * 订单新增
     *
     * @param orderParam 参数
     */
    void add(OrderParam orderParam);

    /**
     * 订单编辑
     *
     * @param orderParam 参数
     */
    void edit(OrderParam orderParam);

    /**
     * 订单删除
     *
     * @param id 主键ID
     */
    void del(Long id);

    StatisticsOrderVo statistics(Integer userId);

    /**
     * @Author slien
     * @Description 商家备注
     * @Date 11:53 2022/10/11
     * @Param [id, userId, remark]
     * @return void
     **/
    void remark(Long id, Integer userId, String remark);

    void cancelOrder(Long id, Integer userId) throws WxPayException, AlipayApiException;

    void dispatchStaff(Long id, Integer[] staffId, Integer userId);

    Boolean qualityOrder(Long id, Long staffId, Integer userId);

    void verificationOrder(Long id, String code, Integer userId);

    Boolean existOrderByStaffId(Long id);

    boolean updateOrderStatusToPaid(String outTradeNo, String transactionId) throws Exception;

    List<Order> getNoStaffByDuration(int time);

    void verificationByDuration(Integer hour);

    List<Order> getOvertimeOrder();

    void updateEntityById(Order orderInfo);

    List<Order> getNoPayOrderByDuration(Integer time);

    void checkOrderStatus(Long id) throws Exception;

    void cancelOvertimeOrder(String orderNo, int userId) throws Exception;

    Order getBySn(String outTradeNo);

    void bindAnnualService(Map<String, String> params);
}
